<?php

$admin_url = base_url('otakkanan');
$kirim_url = base_url('otakkiri');

$mapdir = "
	<a href='$admin_url/' class='taut'>Home</a>
	&gt; 
	<b>Masukan Pengunjung</b>
";

$tampil = "";

$menu = $this->uri->segment(3, "all");

if($menu == "detail")
{
	$idm = $this->input->get('idm');
	$masukan = $this->adminmodel->get_data_masukan($idm);
	
	if($masukan !== FALSE)
	{
		foreach($masukan AS $dmasukan){
			
			$nama = html_escape($dmasukan->nama);
			$email = safe_mailto(html_escape($dmasukan->email));
			$pesan = auto_link(xss_clean($dmasukan->pesan));
			$jam = date("d-m-Y H:i", strtotime($dmasukan->jam));
			
			$tampil = "
			<tr><td class='left'>Masukan Dari</td><td class='right'>$nama ($email) &nbsp; <a href='$kirim_url/hapusmasukan?idm=$idm'>Hapus</a></td></tr> 
			<tr><td class='left'>Dikirim dari IP</td><td class='right'>$dmasukan->alamatip</td></tr> 
			<tr><td class='left'>Dikirim Pada</td><td class='right'>$jam</td></tr> 
			<tr><td class='left'>Masukan</td><td class='right'>$pesan</td></tr>
			";
		}
	}else{
		$tampil = "<tr><td class='left'>&nbsp;</td><td class='right'>Data Tidak Ditemukan</td></tr>";
	}
	
	$tampil .= "<tr><td class='left'>&nbsp;</td><td class='right'>
					<a href='$admin_url/masukan' class='taut'>&lt; Kembali</a>
					</td>
				</tr>";
}
else{
	
	$awal = $this->input->get("awal");
	$masukan = $this->adminmodel->get_masukan($awal);
	
	$config['base_url'] = $admin_url.'/masukan?what=new';
	$config['total_rows'] = $this->adminmodel->hitung_data('id','dn_feedback');
	$config['per_page'] = 20; 
	$config['anchor_class'] = 'class="taut"';
	$config['page_query_string'] = TRUE;
	$config['query_string_segment'] = 'awal';

	$this->pagination->initialize($config); 
	$halaman = $this->pagination->create_links();
	
	if($masukan !== FALSE)
	{
		$tampil = $tampil."<tr><td class='left'>Dari</td><td class='right'>Masukan</td></tr><tr><td class='left'>&nbsp;</td><td class='right'>&nbsp;</td></tr>";
		foreach($masukan AS $dmasukan)
		{
			$idm = $dmasukan->id;
			$nama = html_escape($dmasukan->nama);
			$pesan = word_limiter($dmasukan->pesan, 20);
			
			$tampil .= "<tr><td class='left'> $nama </td><td class='right'>$pesan &nbsp; <a href='$admin_url/masukan/detail?idm=$idm'>Detail</a> </td></tr>";
		}
	}else{
		$tampil = "<tr><td class='left'>&nbsp;</td><td class='right'>Belum Ada masukan coy</td></tr>";
	}
	
	$tampil .= "<tr><td class='left'>&nbsp;</td><td class='right'>$halaman</td></tr>";
	
}

$isipage = "
	<div id='content2'>
			<h3>Masukan Dari Pengunjung</h3>
				
				<div class='isicontent2'>
					<table>
						<tbody>
							
							$tampil
							
						</tbody>
					</table>
				</div>
				
			</div>
";

$data['map_dir'] = $mapdir;
$data['isi_page'] = $isipage;
$data['site_title'] = 'Masukan - Dadan Network';
$data['base_url'] = base_url();
$data['tahun_sekarang'] = date("Y");

$this->parser->parse('template/admin', $data);

/* End of file masukan.php */
/* Location: ./application/views/admin/masukan.php */
